home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 8: LINUX Games
/
Linux Cubed Series 8 - LINUX Games.iso
/
games
/
x11
/
networke
/
civ-0.000
/
civ-0
/
civ-0.3
/
src
/
keyboard.cc
< prev
next >
Wrap
C/C++ Source or Header
|
1995-02-09
|
542b
|
40 lines
#include "graph.h"
#include "keyboard.h"
int MoveXDir(int ch)
{
switch (ch) {
case KEY_UPLEFT:
case KEY_DOWNLEFT:
case KEY_LEFT:
return -1;
case KEY_UPRIGHT:
case KEY_RIGHT:
case KEY_DOWNRIGHT:
return 1;
default:
return 0;
}
}
int MoveYDir(int ch)
{
switch (ch) {
case KEY_UPLEFT:
case KEY_UP:
case KEY_UPRIGHT:
return -1;
case KEY_DOWNLEFT:
case KEY_DOWN:
case KEY_DOWNRIGHT:
return 1;
default:
return 0;
}
}
int MovementKey(int key)
{
return key >= 0x100 && key != NO_KEY;
}